package server;

import planner.*;
import storage.buffer.*;
import storage.file.*;
import metadata.MetadataMgr;
import config.Config;
import log.*;

public class SimpleDB {

	public static int BUFFER_SIZE;

	public static boolean enableLog;

	public static LogManager logm;
	private static AbstractFileManager filem = FileManagerFactory.getFileManager();
	//TODO how to initialize it?
	private static MetadataMgr mdm;

	public static void init() {
		Config.loadFile();
		//TODO This Config is difficult to use

	}

	public static LogManager logManager() {
		return logm;
	}

	public static AbstractFileManager fileManager() {
		return filem;

	}

	public static MetadataMgr mdMgr()     { return mdm; }

	public static Planner planner() {
		QueryPlanner  qplanner = new BasicQueryPlanner();
		UpdatePlanner uplanner = new BasicUpdatePlanner();
		return new Planner(qplanner, uplanner);
	}

	public static QueryPlanner qplanner() {
		return new BasicQueryPlanner();
	}

	public static UpdatePlanner uplanner() {
		return new BasicUpdatePlanner();
	}

}
